#include "trace.hpp"
#include "error.hpp"
#include <cstdarg>
#include <cstdio>

#define TRACE_LEVELS_MASK       ( TRACE_LEVEL_HIGH | TRACE_LEVEL_NORMAL )

void trace ( const char * format, ... )
{
        throw_if ( NULL == format, ERROR_INVALID_ARGUMENTS );
        
        #ifndef RELEASE
                va_list arguments;
                va_start ( arguments, format );
                vprintf ( format, arguments );
                va_end ( arguments );
        #endif
}

void trace ( trace_level_e level, const char * format, ... )
{
        throw_if ( NULL == format, ERROR_INVALID_ARGUMENTS );

        #ifndef RELEASE
                if ( TRACE_LEVELS_MASK & level )
                {
                        va_list arguments;
                        va_start ( arguments, format );
                        vprintf ( format, arguments );
                        va_end ( arguments );
                }
        #endif
}

